<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="./dist/index.js"></script>
    <title>apk-ipa-reader demo</title>
</head>

<body>
    <input type="file" id="file-input" accept="application/*" value="choose file" />
    <div id="file-list"></div>

    <script>
        var reader = new APK_IPA_READER({
            workerScriptsPath: './dist/',
            callback: function (apps) {
                apps.forEach(function (app) {
                    if (!app.status) {
                        console.log(app.info);
                    } else {
                        var fileinfo = app.data;
                        var img = document.createElement('img');
                        img.src = fileinfo.icon;
                        document.getElementById('file-list').appendChild(img);

                        ['name', 'versionShort'].forEach(function (item) {
                            var div = document.createElement('div');
                            div.textContent = fileinfo[item];
                            document.getElementById('file-list').appendChild(div);
                        });
                    }
                });
            },
        });
        reader.byInput(document.getElementById('file-input'));
    </script>
</body>

</html>